import { defineConfig } from 'vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
import vue from '@vitejs/plugin-vue'
import { resolve } from "path"

import { VantResolver } from '@vant/auto-import-resolver';
import { viteMockServe } from "vite-plugin-mock";
//引入自动引入插件
import AutoImport from 'unplugin-auto-import/vite'
// https://vitejs.dev/config/  //npm install @types/node --save-dev
export default defineConfig({
  plugins: [
    vue(),
    AutoImport({
    imports: ['vue'], dts: 'src/auto-import.d.ts',
     resolvers: [ElementPlusResolver(),VantResolver()],
    }),
    Components({
      resolvers: [ElementPlusResolver(),VantResolver()],
    }),
    viteMockServe({
      mockPath: "mock",//解析根目录下的mock文件夹
      localEnabled: true,
    }),
  ],
  // 配置 @ 符号
  resolve: {
    alias: {
      "@": resolve(__dirname, "src")
    }
  }

})


